using System;
using System.Xml.Serialization;

namespace SharpMud.Text.Formatting
{
	[XmlRoot("FormatTokenizationList")]
	public class FormatTokenizationList
	{
		#region Private Variables
		private System.Collections.Generic.List<FormatTokenization> _FormatTokenizations;
		#endregion

		#region Constructors
		public FormatTokenizationList()
		{
            _FormatTokenizations = new System.Collections.Generic.List<FormatTokenization>();
		}
        public FormatTokenizationList(System.Collections.Generic.IList<FormatTokenization> formatTokenizations)
        {
            _FormatTokenizations = new System.Collections.Generic.List<FormatTokenization>();
            _FormatTokenizations.AddRange(formatTokenizations);
        }
        public FormatTokenizationList(params FormatTokenization[] formatTokenizations)
        {
            _FormatTokenizations = new System.Collections.Generic.List<FormatTokenization>();
            _FormatTokenizations.AddRange(formatTokenizations);
        }
		#endregion

		#region Public Properties
		[XmlElement("FormatTokenization")]
		public FormatTokenization[] FormatTokenizations
		{
			get
			{
				return (FormatTokenization[])_FormatTokenizations.ToArray();
			}
			set
			{
				_FormatTokenizations.AddRange(value);
			}
		}
		[XmlIgnore()]
		public int Count
		{
			get
			{
				return _FormatTokenizations.Count;
			}
		}
		#endregion

		#region Public Methods
		public void Add(FormatTokenization tokenization)
		{
			_FormatTokenizations.Add(tokenization);
		}

		public void Clear()
		{
			_FormatTokenizations.Clear();
		}

		public void RemoveAt(int index)
		{
			_FormatTokenizations.RemoveAt(index);
		}
		#endregion
	}
}
